import http from '../utils/request'

export const authService = {
  // 使用code换取openid和session_key
  login: (code) => {
    return http.post('/auth/wx/login', { code })
  },

  // 更新用户信息
  updateUserInfo: (userInfo) => {
    return http.post('/auth/wx/update', {
      nickName: userInfo.nickName,
      avatarUrl: userInfo.avatarUrl
    })
  },

  // 验证token
  validateToken: () => {
    return http.get('/auth/validate')
  }
} 